Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify some things in Objects intro #3721

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TurekBot
Copy link

I noticed a few typos or unclear things while I was reading, so I figured I'd leave things better than I found them. I left an explanation for each change in its commit.

Any suggestions are welcome!

"Signed" makes it sound like you wrote your signature on them or they were cryptographically signed, but that's not the case, so using "labeled" seems like a clearer way to say it.
Using "folder" in the context of a cabinet will be clearer. People know what a folder is; it's not as clear what a file is.
Previously, it had some broken sentences.
Previously, it mentioned wanting to use square brackets. People don't want brackets, they want the flexibility it offers them.
@javascript-translate-bot javascript-translate-bot added the review needed Review needed, please approve or request changes label Jul 21, 2024
@javascript-translate-bot javascript-translate-bot requested a review from a team July 21, 2024 00:52
@CLAassistant
Copy link

CLAassistant commented Jul 21, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@shallow-beach shallow-beach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few thoughts!

@@ -161,7 +161,7 @@ alert( user.key ) // undefined

### Computed properties

We can use square brackets in an object literal, when creating an object. That's called *computed properties*.
If you want to be flexible about naming your properties, you can use something called *computed properties*.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disagree, Line 164 is clarifying that square brackets are computed properties

@@ -101,7 +101,7 @@ For multiword properties, the dot access doesn't work:
user.likes birds = true
```

JavaScript doesn't understand that. It thinks that we address `user.likes`, and then gives a syntax error when comes across unexpected `birds`.
JavaScript doesn't understand that. It thinks that we're referring to `user.likes`, and then gives a syntax error when it comes across the unexpected `birds`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about 'accessing' (used in MDN):

JavaScript doesn't understand that. It thinks that we're accessing user.likes, and then gives a syntax error when it comes across the unexpected birds.

@@ -7,7 +7,7 @@ In contrast, objects are used to store keyed collections of various data and mor

An object can be created with figure brackets `{…}` with an optional list of *properties*. A property is a "key: value" pair, where `key` is a string (also called a "property name"), and `value` can be anything.

We can imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key. It's easy to find a file by its name or add/remove a file.
We can imagine an object as a cabinet with labeled folders. Every piece of data is stored in its folder by the key. It's easy to find a folder by its name or add/remove a folder.
Copy link
Contributor

@shallow-beach shallow-beach Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file is clear IMO, see File cabinet wiki. i don't think folders is less clear though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review needed Review needed, please approve or request changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants